--[[
	-- 直接从datasheet中获取排行榜数据库
	-- datasheet 不能放在这里的requier，所以放到 agent.lua 中了
]]
local filename = "getrank.lua"

local timetool = require "timetool"
local skynet = require "skynet"
local cluster = require "skynet.cluster"
local filelog =require "filelog"

local service = nil
local CMD = {
	service = nil
}

function CMD.process(rid, msgbody)
	if not service then
		service = CMD.service
	end
	local rankdata = skynet.call(".router", "lua", "getrank", msgbody.ranktype)

    if rankdata and rankdata.ranklist then
        for _,item in pairs(rankdata.ranklist) do
            local rolename = item.rolename or ""
            local intro = item.intro or ""
            item.rolename = service:filterSensitiveWords(rolename)
            item.intro = service:filterSensitiveWords(intro)
        end
    end

    return rankdata or { ranktype = msgbody.ranktype}
end

return CMD